Carbon


HandleControlKey

Header: Controls.h Carbon status: Supported

Sends a keyboard event to a control with keyboard focus.

SInt16 HandleControlKey (
    ControlRef inControl, 
    SInt16 inKeyCode, 
    SInt16 inCharCode, 
    EventModifiers inModifiers
);
inControl

A handle to the control that currently has keyboard focus.

inKeyCode

The virtual key code, derived from the event structure. This value represents the key pressed or released by the user. It is always the same for a specific physical key on a particular keyboard regardless of which modifier keys were also pressed.

inCharCode

A character, derived from the event structure. The value that is generated depends on the virtual key code, the state of the modifier keys, and the current 'KCHR' resource.

inModifiers

Information from the modifiers field of the event structure specifying the state of the modifier keys and the mouse button at the time the event was posted.

function result

The part code that was hit during the keyboard event; see “Meta Control Part Code Constants”, “Control Part Code Constants”, and “Control State Part Code Constants”.0

DISCUSSION

If you have determined that a keyboard event has occurred in a given window, before calling the HandleControlKey function, call GetKeyboardFocus to get the handle to the control that currently has keyboard focus. The HandleControlKey function passes the values specified in its inKeyCode, inCharCode, and inModifiers parameters to control definition functions that set the kControlSupportsFocus feature bit.

VERSION NOTES

Available with Appearance Manager 1.0 and later.

AVAILABILITY

Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)